Option Explicit

' ======================================================================
' Descriptor
' SqlConfigSheet 中 SqlParam 单元下，每个参数的描述器的生成器
' ======================================================================

' ======================================================================
' Implement
' ======================================================================

Implements TriFunction

' ======================================================================
' Implement TriFunction
' ======================================================================
' 生成sql参数的描述器
'
' @param sh As Worksheet 数据源 sheet
' @param rowNo As Long 当前正在处理的 value
' @param keyColNo As Integer key所在的列号
Public Function TriFunction_apply(ByRef sh As Variant, ByRef rowNo As Variant, ByRef keyColNo As Variant) As Variant
    Dim pVal As String
    Dim typeVal As String
    Dim key As String

    ' 1. 获取参数值 + 参数类型 + key
    With sh
        pVal = .Cells(rowNo, keyColNo + 1).Value
        typeVal = .Cells(rowNo, keyColNo + 2).Value

        key = .Cells(rowNo, keyColNo).Value
    End With

    ' 2. 生成参数描述器
    Dim paramDiscriptor As SQLParamDescriptor
    Set paramDiscriptor = New SQLParamDescriptor
    paramDiscriptor.Init key, pVal, typeVal

    ' 3. 返回结果
    Set TriFunction_apply = paramDiscriptor
End Function